UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XVMnT0DM5pcQBKnvQ7Tz2V0XRhZkjWcwawK4d669NtE=' 
WHERE 
  key_id = '1b4f8291ea1343fd6cbf0246527773605e22a56139099ac7d989fee1cd2f0581' 
  AND (
    token = 'XVMnT0DM5pcQBKnvQ7Tz2V0XRhZkjWcwawK4d669NtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028