UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OTEy92KxEqdZiXwRLUmDntUZU0Toi6FNwQ3rkk8p8Ow=' 
WHERE 
  key_id = '69b076bc86b3a6a5d4c80dec68df33d3640918742f2dbdb1b838c35fd6a4d291' 
  AND (
    token = 'OTEy92KxEqdZiXwRLUmDntUZU0Toi6FNwQ3rkk8p8Ow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048