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

Query time 0.00015