UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tq9k/EuWbW2XwDYs0iCta7oGPCbSagH0uKJdOkyq9+Q=' 
WHERE 
  key_id = 'cdfec00552c2592109439485ab1b27e01e9ba8ad24c3ebd1f75e362e45594c03' 
  AND (
    token = 'tq9k/EuWbW2XwDYs0iCta7oGPCbSagH0uKJdOkyq9+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023