UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3+BaQqwExYAkA7pdKupey/u31mFMcDxVcVCh87+qGsU=' 
WHERE 
  key_id = '20cf8222a7f5745f13e646d7703a548fd1523c0fabb11cf5a7c1e5c932b44107' 
  AND (
    token = '3+BaQqwExYAkA7pdKupey/u31mFMcDxVcVCh87+qGsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024