UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zBpQZMUvKIcDSe8jG2S73DukGqjj/lKT3Eb8ToHPEEI=' 
WHERE 
  key_id = 'c6e16c270b6d3990b54e10d6ff163144567842717f1317cd66a1480d2d70ec47' 
  AND (
    token = 'zBpQZMUvKIcDSe8jG2S73DukGqjj/lKT3Eb8ToHPEEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045