UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TFg59pbKyf5DdmuaajFI36cHNqF/2GNHVUpb7ohMnK8=' 
WHERE 
  key_id = 'c3a417693f62ae9d0d22cbc104b55c83967035c1e3bad61a7daf527ea7fad787' 
  AND (
    token = 'TFg59pbKyf5DdmuaajFI36cHNqF/2GNHVUpb7ohMnK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032