UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'exUO6tzvt7U3Ecmq9eSL5IlHXNTiTzA4ECIVir+Cr30=' 
WHERE 
  key_id = 'd57a19811258c2580009c0fc2dd36097068f6fb4a58c278b0a951d0a314b910c' 
  AND (
    token = 'exUO6tzvt7U3Ecmq9eSL5IlHXNTiTzA4ECIVir+Cr30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017