UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N0NSM5y17ov57u39JnjLSn0FyQUbG443nmXyTtCl2I0='
WHERE
key_id = '74a740722d3bdc8c5710b0a8327578e1c5ed61a0ab3c0c39c09e1b39985788de'
AND (
token = 'N0NSM5y17ov57u39JnjLSn0FyQUbG443nmXyTtCl2I0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)