UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZczxrI+8fo61lB6vjOCxV3DQdjvhW6AIfRyXPA6bbeA=' 
WHERE 
  key_id = 'fab121b5a378d6012532a741e51054b90196684455e448e604bb40f7a8753074' 
  AND (
    token = 'ZczxrI+8fo61lB6vjOCxV3DQdjvhW6AIfRyXPA6bbeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042