UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GaO7H5dpCfjzs6BFefFKC1z8hxlGRnN5VZ3D7ovSKPM=' 
WHERE 
  key_id = '65a2d22ff69b756386c554eb7f4162b548e8bd54b212a60095e685af5a17e236' 
  AND (
    token = 'GaO7H5dpCfjzs6BFefFKC1z8hxlGRnN5VZ3D7ovSKPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039