UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LPXoqYY0uEepnRuL/usckbo+wNRkgOf/K6maafL1ZhQ=' 
WHERE 
  key_id = '21f427fd421d91e1f9403f6d9026e2e57df7cd079864fd72d8b42357be11a9bc' 
  AND (
    token = 'LPXoqYY0uEepnRuL/usckbo+wNRkgOf/K6maafL1ZhQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030