UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gaw8dagh9UaXNhmSUV08hDgFfCWEjlKTmQ35BcWXVXs=' 
WHERE 
  key_id = '18a1c6790f26b9060e264adbec483c9ddd75b497bafb698602835f87641dfba6' 
  AND (
    token = 'gaw8dagh9UaXNhmSUV08hDgFfCWEjlKTmQ35BcWXVXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030