UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KD0heKjlkyUUZPp5ebiJBQdq0N7Y+TGAyMjKjO4qSYA='
WHERE
key_id = '818e2bd4ffdb5be04cf44f60f7f4bd55c32d88a6864cdc968adafc078a762fb3'
AND (
token = 'KD0heKjlkyUUZPp5ebiJBQdq0N7Y+TGAyMjKjO4qSYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)