UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '14grT16NBxs6kymYNyJi+encNOeqf7MeMZqN6tcilbk='
WHERE
key_id = 'c7724ab1274a1d6662df22a0ab08eb85c14914a3abc42124af1ce69af3ec74ad'
AND (
token = '14grT16NBxs6kymYNyJi+encNOeqf7MeMZqN6tcilbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)