UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ffNTGUDqbWF8kZARtooTBUI2WlAekm5y6Xmqnai3nuI='
WHERE
key_id = 'de78d1be6e92a416d4d5b1a332020190cb2ca783022ce31f73fb7d6e471327f9'
AND (
token = 'ffNTGUDqbWF8kZARtooTBUI2WlAekm5y6Xmqnai3nuI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)