UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iTc8gbHCf1PVCpZesbdcUC+mH3b3F8JCepxlBFoeODA=' 
WHERE 
  key_id = 'a7be39ba5ea5261e1b266cfcea740fddaffc5471e924f8179121c1d789deb606' 
  AND (
    token = 'iTc8gbHCf1PVCpZesbdcUC+mH3b3F8JCepxlBFoeODA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044