UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KYyeSf5bqzky7x91gsNRkzGML6pr2qx8terntvc0j9A=' 
WHERE 
  key_id = '907c09f5407e17a625a171472b7090d163f32f5b9a83a65828b58b4f0bba4833' 
  AND (
    token = 'KYyeSf5bqzky7x91gsNRkzGML6pr2qx8terntvc0j9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040