UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+OdZWRFzVXngOj0LCaE92VKL7wgU8JWVc24hyq5NGDE=' 
WHERE 
  key_id = '21e98964856d85f1ed1604bd3f98ccad23d73e094aa126ecec88e92afb601b2b' 
  AND (
    token = '+OdZWRFzVXngOj0LCaE92VKL7wgU8JWVc24hyq5NGDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048