UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5dQ1A7KCk8Hohm39kJ/wu4YGGAPe2OFgjGvVMdyNPwE=' 
WHERE 
  key_id = '3ce18977608a5509c19e4b70001dedcf110eb323adad85782281b8fe940661d0' 
  AND (
    token = '5dQ1A7KCk8Hohm39kJ/wu4YGGAPe2OFgjGvVMdyNPwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016