UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l+kWM8zbs34G7w6SfrwJnP4JzpbEVe0JQ65EuFprxZc=' 
WHERE 
  key_id = 'e376ad4541454c34b193b1f72327e9a0069924a701b93822f70010a4481c2dce' 
  AND (
    token = 'l+kWM8zbs34G7w6SfrwJnP4JzpbEVe0JQ65EuFprxZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026