UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1BuCp6vXJEYWzrP1ddRCOtMH9swPCsgaacjU4cZyiZU='
WHERE
key_id = 'd3a8896f79ebb69385f9cde2fec0b8d87d301b864a481ee78a359f5bb61c8c2e'
AND (
token = '1BuCp6vXJEYWzrP1ddRCOtMH9swPCsgaacjU4cZyiZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)