UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g8QKAOHyIi/yayDM3SVFqm9U3auFXgfsoOmlotSNhoc='
WHERE
key_id = '40d80dd71a27ef34869cff40f31305c08f7dde5f66e1c75b79a9b290345a079a'
AND (
token = 'g8QKAOHyIi/yayDM3SVFqm9U3auFXgfsoOmlotSNhoc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)