UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gwOi8iTK3tGkCdP+ATr0GckN/ZUfseJM3EuhGgxIkjc=' 
WHERE 
  key_id = '539916f1886ab0f4f01297a798650a16c67c6b9972e436e353855812a64c26ff' 
  AND (
    token = 'gwOi8iTK3tGkCdP+ATr0GckN/ZUfseJM3EuhGgxIkjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026