UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZA8d3GBCuBMxOWE4Zj8kzRQwXPJjIqA7A9uLTwHdS4g=' 
WHERE 
  key_id = '13e8961476642fe36a2c0789c5f5d1d2288354776838436834e664c2412c92bd' 
  AND (
    token = 'ZA8d3GBCuBMxOWE4Zj8kzRQwXPJjIqA7A9uLTwHdS4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054