UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3mXic9WoOmaDbYFATu6YhQjRnUgqg/WuASZHNIYrI9c='
WHERE
key_id = '9020b961696fddd68de6c7a65755adcc934f246b8b959d11c6d4a0b27c9396c6'
AND (
token = '3mXic9WoOmaDbYFATu6YhQjRnUgqg/WuASZHNIYrI9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)