UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '12b5Nzt6pmFLkDC1ZqXs48ENBVdHohtgGrOMAZHCFMk='
WHERE
key_id = 'fd52be0e5ac5e8d77d388ee89eabc0aef4eab429b4f315c7f02828a259927c55'
AND (
token = '12b5Nzt6pmFLkDC1ZqXs48ENBVdHohtgGrOMAZHCFMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)