UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N1xg3HCSmj0OmJOfRCddwrzVtQaWo1JqeBKsw78jDWg='
WHERE
key_id = '3b0013ea636850ab7cf8b8db38a6b8d7fd0382e581a61291113272f4596a8ddf'
AND (
token = 'N1xg3HCSmj0OmJOfRCddwrzVtQaWo1JqeBKsw78jDWg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)