UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j+TWrKtqJ0OiNVhmTi7oKE+Wk9BjRo1qTpjT4cK1pH8=' 
WHERE 
  key_id = 'a8981235310da1e087288162e832a1a2d3bf790c757bd6a052cf47347791bd16' 
  AND (
    token = 'j+TWrKtqJ0OiNVhmTi7oKE+Wk9BjRo1qTpjT4cK1pH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018