UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OKHPAOcROO3SN3JY8r/4Xd67HW/s5o5EHeWFuyPSDdY=' 
WHERE 
  key_id = 'f54ad93909ba5701fc9b3a940844ff8e43a529cebd33c5febd8657968041118f' 
  AND (
    token = 'OKHPAOcROO3SN3JY8r/4Xd67HW/s5o5EHeWFuyPSDdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00106