UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vRvvKDpvnVrb/alIVTi/0CNhzb0pV0v+/5OHlxZdnss='
WHERE
key_id = 'a32cd256f23f94e713f6d8edc64e179c0e5f71e584395fb7b56f9ad64b97da4d'
AND (
token = 'vRvvKDpvnVrb/alIVTi/0CNhzb0pV0v+/5OHlxZdnss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)