UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y8YB3pCeg6tIe4bNOdBv1wcQoLQOeltew894izJ9o+Y=' 
WHERE 
  key_id = 'ed69bd5f573846944dc198889e5941a10e32b1709852bd4379c534569156eb5e' 
  AND (
    token = 'Y8YB3pCeg6tIe4bNOdBv1wcQoLQOeltew894izJ9o+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030