UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B5CI6UimRki+qfhwDFW0Eq8DmozRt8mEaxQh5WWC7LQ=' 
WHERE 
  key_id = 'a17713f9ded126d7f3eb0eeab56fb68ea7e53ac9ea15efd3fe3b862883ba3d3f' 
  AND (
    token = 'B5CI6UimRki+qfhwDFW0Eq8DmozRt8mEaxQh5WWC7LQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018