UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EJYp8t5oH6oDmifK5D+XdH9zZGJUpDs8YU9fSpVf5zw=' 
WHERE 
  key_id = '0b3fcd67e6f714eba707424c35ac5c01b6b71e2e1fd8fc942d290c7b2814861a' 
  AND (
    token = 'EJYp8t5oH6oDmifK5D+XdH9zZGJUpDs8YU9fSpVf5zw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053