UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EufvS2eG4G78acVM0AkUUzuA7XZUYHT0lPPsfj3j7bM=' 
WHERE 
  key_id = '617f51b65a762bed73aad467d204e3e41dddb422df6a3ba31a59f28ee05adb9f' 
  AND (
    token = 'EufvS2eG4G78acVM0AkUUzuA7XZUYHT0lPPsfj3j7bM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049