UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YGhuTGcB9kR5lcGooxjYMTsuiJXBOHOPE53UZpB0lbQ=' 
WHERE 
  key_id = '711aba17e01c94c75166b76f75ab318c3c4ad105650847a38b7752ccc7548317' 
  AND (
    token = 'YGhuTGcB9kR5lcGooxjYMTsuiJXBOHOPE53UZpB0lbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033