UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QqrfdQ1X6o9lLOrWgOD+Wdpqxsft3Q4CjNQklASXKpQ=' 
WHERE 
  key_id = 'd493f265eb7bbabf44eea4bf939fd9e487ca49710467f05fadd690e90d4fa1d9' 
  AND (
    token = 'QqrfdQ1X6o9lLOrWgOD+Wdpqxsft3Q4CjNQklASXKpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030