UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9fY7yAwisr017EUbk2IEQczqizyEq3nAZfxgPuiEAJM='
WHERE
key_id = '8b5a8ed18739b5a5305f618a9bec096f319291d46632c05f192133b43234b327'
AND (
token = '9fY7yAwisr017EUbk2IEQczqizyEq3nAZfxgPuiEAJM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)