UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nNMhzHd3jw7j0tOAaVWquN7qp2SIzZUQ/ByNwQp7YTQ=' 
WHERE 
  key_id = '6059b21a819c576e64fb9eefdcf66dba6e15e9a6a428364a2f2da959b1c53dc0' 
  AND (
    token = 'nNMhzHd3jw7j0tOAaVWquN7qp2SIzZUQ/ByNwQp7YTQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025