UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3okehtSKKRGkXkziTGXmwXQBaq+K+5OATUZFtV6l4jk=' 
WHERE 
  key_id = 'eb1ea2d487b109f71bb12104787d4ce5f5f68271bb780b89ad3c74feb4b7b181' 
  AND (
    token = '3okehtSKKRGkXkziTGXmwXQBaq+K+5OATUZFtV6l4jk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038