UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qsNaT8Jbipq1FtrGdbIwYi76x5HlUacSXQHsJmaGQ5g='
WHERE
key_id = '1b981b3fc2d2154b5ba06062fe153b875ef8fd90bec1ac8d4155f48524ea2784'
AND (
token = 'qsNaT8Jbipq1FtrGdbIwYi76x5HlUacSXQHsJmaGQ5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)