UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BTd7eZh9A8pJUi0lTb3NekUJup6amSHWL7bztBhpf7I='
WHERE
key_id = '3450e86ccd1a2df3cae31f8de75e2e47bc0c1727715ab04587b8c3a6d5c52b3d'
AND (
token = 'BTd7eZh9A8pJUi0lTb3NekUJup6amSHWL7bztBhpf7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)