UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H97Ti6sxExUud8IlgL8P+RlklUrxSPcbYL59dxr8MeA='
WHERE
key_id = 'a3f426853d70cb1ec68b6a992fe3a5379f7ef323bb9b4cd90588f90a95992d00'
AND (
token = 'H97Ti6sxExUud8IlgL8P+RlklUrxSPcbYL59dxr8MeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)