UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y6jdq+u62wTqWxztmspMKvjN0uiq1CxyEt02FQp6x/Q=' 
WHERE 
  key_id = '5622b9a352c4107caa87e73b8f77e18da24941f2aae143d64a362bc828689187' 
  AND (
    token = 'y6jdq+u62wTqWxztmspMKvjN0uiq1CxyEt02FQp6x/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025