UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KhFL0RkDyqzyXtF5Eg6p9aOIucZUCNQlQ4tG+GFYRWc='
WHERE
key_id = 'd2c2084199006d2dd08164485681191633b66681e0b2647b8cec9b1e96148eb4'
AND (
token = 'KhFL0RkDyqzyXtF5Eg6p9aOIucZUCNQlQ4tG+GFYRWc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)