UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G1o69a0Bus+4lFfYn6+SaKNmvHyUgRNyyrT3SC1a2YY=' 
WHERE 
  key_id = 'af7514408a3009af1ff318f4ad49710f5016eebd2cd55b9d5257a8902e4c0e27' 
  AND (
    token = 'G1o69a0Bus+4lFfYn6+SaKNmvHyUgRNyyrT3SC1a2YY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034