UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gNhvXVmUA0NFPb0cOom/wwQE+daVxC7jJ2kqv/ZkENI='
WHERE
key_id = '250e4d5ee5d979acd5735aeca8a9b86a62be77c3370a65a61ab9414dad8dd7d1'
AND (
token = 'gNhvXVmUA0NFPb0cOom/wwQE+daVxC7jJ2kqv/ZkENI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)