UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EGq9c1CrMdwQguGyPxpzaLigX6fTMAoHhC51QMVMKhg='
WHERE
key_id = 'f59b0f4f1c32ebe6fcb9e93b1b354c455a59416eec5d179999812496ddab5e43'
AND (
token = 'EGq9c1CrMdwQguGyPxpzaLigX6fTMAoHhC51QMVMKhg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)