UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NHFDIn39bH+KawOj1+9LcS4lDuOER1Py0mICEj+UWDg='
WHERE
key_id = '12b6619b65357756592c3db565e4531509c0c45b256d9658d1a25285d81fa1ca'
AND (
token = 'NHFDIn39bH+KawOj1+9LcS4lDuOER1Py0mICEj+UWDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)