UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JrCdqcL2A3ouc+lsWrAEt2WxYUrq0mFaqX+zXSzDRDo=' 
WHERE 
  key_id = 'e6a377df73f5854c10ab374dd8e3bd174697efb976c53003fda8d48b54c8a14d' 
  AND (
    token = 'JrCdqcL2A3ouc+lsWrAEt2WxYUrq0mFaqX+zXSzDRDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031