UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ux1QubmSVE3koRk/+IeB63h2Tnm1bKQV6dsOnKXWjdQ=' 
WHERE 
  key_id = '7b107351dfc4112466a844b15256ff689602c52b7044cb79665edd03ec96cd78' 
  AND (
    token = 'Ux1QubmSVE3koRk/+IeB63h2Tnm1bKQV6dsOnKXWjdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046