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

Query time 0.00042