UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vI+eprdUGOFSxgzPkehTLxEw5tk7LjP6ohSNrahxp2Q=' 
WHERE 
  key_id = 'a85babcb067246ae806742ec5f1c77e3cc25b902abdce6b3370201f30954eea5' 
  AND (
    token = 'vI+eprdUGOFSxgzPkehTLxEw5tk7LjP6ohSNrahxp2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032