UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't1xzCuL/wz0x5sJzszbvjrywlc0AEqyTxEYJiiSEMN4='
WHERE
key_id = '470325d5416ca546219e8a34a575e137082f3035d7b5a90fee696e2fdf2a7cd9'
AND (
token = 't1xzCuL/wz0x5sJzszbvjrywlc0AEqyTxEYJiiSEMN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)