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