UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R938LIyURpPAbdYd+UYxOc9CgQTEq0tbF1my0nXFV/Q=' 
WHERE 
  key_id = 'c5631b4765befcdcef2e518875fd721ba42b1d203f3774f71dc8bb9041216a36' 
  AND (
    token = 'R938LIyURpPAbdYd+UYxOc9CgQTEq0tbF1my0nXFV/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033