UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MwLwxsFkWXiiSBN+Hh/zeBrN/FGEq65ko6azNAHS65I='
WHERE
key_id = 'd4c013ed0aeb5e2ad0b394a478904de385d7207e401814e8e540b0e5f81e93b9'
AND (
token = 'MwLwxsFkWXiiSBN+Hh/zeBrN/FGEq65ko6azNAHS65I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)