UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BYTF3O7lD/zRwefSj5RHJcFSfGRxwCpQUSIuq6dcXZw='
WHERE
key_id = 'f50552d7b6c5afc8cc7c8dd9363c520d54d1b989fc5c638eedd4ca512d43ba06'
AND (
token = 'BYTF3O7lD/zRwefSj5RHJcFSfGRxwCpQUSIuq6dcXZw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)