UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dQB8Uuqqe4R4UoieFVsgG46iZPmvMx18jDMs4iKO40k=' 
WHERE 
  key_id = '0c042e39f1ad61c09da1b81692f01912c27b7cd3b4ec66c53ffc09feeb937b1d' 
  AND (
    token = 'dQB8Uuqqe4R4UoieFVsgG46iZPmvMx18jDMs4iKO40k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028