UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5XRBZ+P1Ps06haGpAy2nSmLF9yhqyRrxAUw5BBuS2uc=' 
WHERE 
  key_id = 'a53a2663bfef17d7a62e262054042be1062624923860af7e3c8c3041cee009c9' 
  AND (
    token = '5XRBZ+P1Ps06haGpAy2nSmLF9yhqyRrxAUw5BBuS2uc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032