UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'np2Jtkc4MDHrhBLi9tzy+FElQb4mLpi9pQ8B016Xm6k=' 
WHERE 
  key_id = '777ede4b206185484ddbdb302a6e4f1e4db6b9a6390376121f2ff77db13147f9' 
  AND (
    token = 'np2Jtkc4MDHrhBLi9tzy+FElQb4mLpi9pQ8B016Xm6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031