UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AQxBZXPVhKWZ7WC8ZDSyHDvKSi2Qa3sJUXgoU8CRQ+M='
WHERE
key_id = 'e31899b82db23fc3b9a3dd1a2c8bd16d40f1a6ddfe051f93e067ed2242f409e8'
AND (
token = 'AQxBZXPVhKWZ7WC8ZDSyHDvKSi2Qa3sJUXgoU8CRQ+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)