UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'naCfKvqZkYoH4D+uU0ljK27KiFIjTUsvX7lRmPOSxEM=' 
WHERE 
  key_id = '7f4f7ad21624d0f6e692418f24b4446f8213e2caf8d82c04660fe4fc358d1f02' 
  AND (
    token = 'naCfKvqZkYoH4D+uU0ljK27KiFIjTUsvX7lRmPOSxEM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019